import fetch from './fetch'

export function queryList({ page, limit }) {
	return fetch({
		url: 'insurance/business/queryList',
		method: 'get',
		params: { page, limit }
	})
}

export function queryPayState(businessId) {
	return fetch({
		url: 'insurance/open/queryPayState',
		method: 'post',
		params: { businessId },
		data: {
			businessId
		},
		headers: {
			'Content-Type': 'application/json'
		}
	})
}
export function createPcOrder(data, params) {
	return fetch({
		url: 'insurance/insure/createPcOrder',
		method: 'post',
		data,
		params,
		headers: {
			'Content-Type': 'application/json'
		}
	})
}
// 查订单
export function queryOrder({ page, limit }) {
	return fetch({
		url: 'insurance/business/queryOrder',
		method: 'get',
		params: { page, limit }
	})
}

// 订单保存-移动端
export function createH5Order(data) {
	return fetch({
		url: 'insurance/insure/createH5Order',
		method: 'post',
		data,
		headers: {
			'Content-Type': 'application/json'
		}
	})
}
// 跳转支付
export function goPay(params) {
	var urlParams = new URLSearchParams(params)
	var url =
		(process.env.NODE_ENV == 'development' ? 'http://zhibao.natapp1.cc' : '') +
		'/api/insurance/insure/goPay?' +
		urlParams.toString()
	return fetch({
		url: 'insurance/insure/goPay',
		method: 'get',
		params
	})
}

// 获取支付结果
export function payQuery(params) {
	return fetch({
		url: 'insurance/insure/payQuery',
		method: 'get',
		params,
		remind: false
	})
}

// 订单信息
export function queryH5Order({ businessId }) {
	return fetch({
		url: 'insurance/insure/queryH5Order',
		method: 'get',
		params: { businessId }
	})
}

// 获取电子保单地址
export function electronicPolicy(params) {
	return fetch({
		url: 'insurance/insure/downInsured',
		method: 'post',
		params
	})
}

// 订单基本信息
export function information(params) {
	return fetch({
		url: 'field/information',
		method: 'post',
		params
	})
}
// 项目资料查询
export function orderDetail({ businessId }) {
	return fetch({
		url: 'insurance/insure/orderDetail',
		method: 'post',
		params: { businessId }
	})
}
